<?php if ($view->successAssociate === true): ?>
    <div class="alert alert-success">
        Se asigno correctamente el <strong>centro de intercambio</strong> al 
        <strong>almacenista</strong>.
    </div>
<?php endif; ?>
<?php if ($view->successAssociate === false): ?>
    <div class="alert alert-danger">
        No fue posible asociar el <strong>centro de intercambio</strong> al 
        <strong>almacenista</strong>.
    </div>
<?php endif; ?>
<a class="btn btn-primary" href="<?php
echo $view->url(array('module' => 'Admin', 'controller' => 'AdminUsers',
    'action' => 'index'));
?>">
    <span class="glyphicon glyphicon-plus"></span>
    Agregar almacenista
</a>
<br/>
<br/>
<div class="panel panel-primary">
    <div class="panel-heading">Almacenistas</div>
    <table class="table table-bordered table-condensed table-striped">
        <thead>
            <tr>
                <th>Nombre</th>
                <th>Centro de intercambio</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($view->storer as $storer): ?>
                <tr>
                    <td><?php echo $storer->getFullName(); ?></td>
                    <td>
                        <?php
                        $nameExchangeCenter = $storer->getNameExchangeCenter();
                        if ($nameExchangeCenter === null)
                        {
                            ?>
                            <a href="<?php
                            echo $view->url(array(
                                'controller' => 'Admin',
                                'action' => 'associateExchangeCenter',
                                'storerId' => $storer->getId()));
                            ?>" class="btn btn-default">
                                <span class=""></span>
                                Asignar centro de intercambio
                            </a>
                            <?php
                        }
                        else
                        {
                            echo $nameExchangeCenter;
                        }
                        ?>
                    </td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
</div>
